<%--
  Created by IntelliJ IDEA.
  User: lhl
  Date: 2014/4/18
  Time: 21:00
  To change this template use File | Settings | File Templates.
--%>
<html>
  <head>
    <title></title>
      <script type="text/javascript">
       var uri="ws://im.ihi.xiami.com:80";
                  var socket = new WebSocket(uri);
       socket.onopen = function(event) {

           // 发送一个初始化消息
           socket.send('I am the client and I\'m listening!');

           // 监听消息
           socket.onmessage = function(event) {
               console.log('Client received a message',event);
           };

           // 监听Socket的关闭
           socket.onclose = function(event) {
               console.log('Client notified socket has closed',event);
           };

           // 关闭Socket....
           //socket.close()
       };
      </script>
  </head>
  <body>
ddfdfdfdf
  </body>
</html>
